<template>
	<view style="display: flex;align-items: center;" @click="to_detial">
		<radio value="r1" :checked="goods.goods_state" color="red" style="margin: 0 10rpx;" v-if="showRadio"
			@click.stop="changeRadio" />
		<view style="height: 200rpx;width: 200rpx;display: flex;">
			<image :src="goods.goods_small_logo" mode="scaleToFill" style="height: 100%;"></image>
		</view>
		<view
			style="display: flex;flex-direction: column;justify-content: space-between;padding-left: 20rpx;height: 110px;">
			<view style="font-size: 24rpx;letter-spacing: 5rpx;">{{goods.goods_name}}</view>
			<view style="display: flex;justify-content: space-between;">
				<text style="color: red;font-size: 18px;">￥{{goods.goods_price | toFilex}}</text>
				<view @click.stop="test">
				<uni-section  type="line" v-if="showNumberBox" style="flex: 1;padding-right: 20rpx;">
					<uni-number-box :min="1" @change="changeValue" :value="goods.goods_count"  />
				</uni-section>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		name: "good-list",
		props: {
			goods: {
				type: Object,
				default: {}
			},
			showRadio: {
				type: Boolean,
				default: false
			},
			showNumberBox:{
				type:Boolean,
				default:false
			}
		},
		data() {
			return {

			};
		},
		methods: {
			to_detial() {
				this.$emit("Myclick")
			},
			changeRadio() {
				this.$emit('Onradio', this.goods)
				
			},
			changeValue(newValue){
				this.$emit("ChangeNum",{goods_id:this.goods.goods_id,newValue})
			},
			test(){
				// console.log("冒泡");
			}
		},
		filters: {
			toFilex(num) {
				return Number(num).toFixed(2)
			}
		},
	}
</script>

<style scoped>

</style>
